<template>
  <!-- 对话框 -->
  <div>
    <el-dialog :title="dialogTitle" :visible="dialogVisible" width="40%" :before-close="handleClose">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">

            <el-form-item prop="typeId" label="typeId">
              <el-input v-model="form.typeId" size="mini" placeholder="请输入typeId" />
            </el-form-item>

            <el-form-item prop="realCode" label="realCode">
              <el-input v-model="form.realCode" size="mini" placeholder="请输入realCode" />
            </el-form-item>

            <el-form-item prop="supplierId" label="supplierId">
              <el-input v-model="form.supplierId" size="mini" placeholder="请输入supplierId" />
            </el-form-item>

            <el-form-item prop="supplierName" label="supplierName">
              <el-input v-model="form.supplierName" size="mini" placeholder="请输入supplierName" />
            </el-form-item>

        <el-form-item>
          <el-row type="flex" justify="end" style="margin-top: 10px;">
            <el-button size="mini" @click="handleClose">取 消</el-button>
            <el-button size="mini" type="primary" @click="btnOK">确 定</el-button>
          </el-row>
        </el-form-item>
      </el-form>
      <imgSearch ref="imgSearch" 
        dialogTitle="图标" 
        :dialog-visible.sync="imgVisible" 
        :data="this"
        />
    </el-dialog>
    
  </div>

</template>

<script>
import baseData from '@/baseData'
import imgSearch from '../../img/imgSearch.vue'
export default {
  name: 'TypeSupplierAdd',
  components: {
      imgSearch,
    },
  props: {
    dialogVisible: {
      default: false,
      type: Boolean
    },
    dialogTitle:'',
    form:{},
    data:null,
  },
  data() {
    return {
      imgBaseUrl:baseData.basePathUser+'/tbFile/fileById?id=',
      rules:[],
      img:'',
      imgVisible:false,
    }
  },
  watch: {
    
  },
  mounted() {

  },

  methods: {
    // 取消
    handleClose() {
      this.$emit('update:dialogVisible', false)
    },

    // 确定
    async btnOK() {
      this.data.fn.submitTypeSupplier();
    },
   
    Close() {
      this.showVisible = false
      this.handleClose()
    },
    showImg(img){
      this.img = img
      this.imgVisible = true
    },
    selectImg(id){
      this.form[this.img] = id
      this.imgVisible = false
    }
  }
}
</script>

<style lang="scss" scoped></style>
